<template>
  <div id="app" class="">
      <TopInfo ref="topinfos" :names="setting.site_name" :wx="setting.wei_image" :wb="setting.weibo_image"></TopInfo>
      <TopLogo :kefutel="setting.ke_mobile" :kefutime="setting.ke_time"></TopLogo>
      <Router ref="routes" :types="types"></Router>
      <transition name="fade" mode="out-in">
          <router-view @tologin="tologin"/>
      </transition>
      <Bottom :setting="setting"></Bottom>
  </div>
</template>

<script>
    import TopInfo from './components/commons/TopInfo'
    import TopLogo from './components/commons/TopLogo'
    import Router from './components/Router'
    import Bottom from './components/commons/Bottom'

    export default {
        name: 'App',
        components:{TopInfo,TopLogo,Router,Bottom},
        data(){
            return{
                setting:'',
                types:'',
                childrens:[
                    {
                        name:'玉米',term_id:'1',
                        data:[{name:'玉米简介',term_id:'2'},{name:'玉米手册',term_id:'3'}]
                    },
                    {
                        name:'茶叶',term_id:'4',
                        data:[{name:'茶叶简介',term_id:'5'},{name:'茶叶手册',term_id:'6'}]
                    },
                    {
                        name:'核桃',term_id:'7',
                    },
                ]
            }
        },
        created(){
            this.getMsg();
        },
        methods:{
            tologin(){
                this.$refs.topinfos.changeShowBox('loginshow','');
            },
            getMsg(){
                var v = this;
                v.$axios.post('/index.php?g=portal&m=index&a=setting_all')
                    .then((res) => {
                        res = res.data;
                        if (res.result == 1) {
                            v.setting = res.setting;
                            v.types = res.type;
                            localStorage.setItem('types',JSON.stringify(v.types));
                        } else {
                            v.$message.error(res.msg || '获取失败！');
                        }
                    }).catch((err) => {
                    v.$message.error('获取失败！');
                });
            }
        }
    }
</script>

<style>

</style>
